package com.aq.sales.business.impl;

import org.hibernate.SessionFactory;
import org.hibernate.classic.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;

import com.aq.sales.business.intf.CommonBO;
public abstract class CommonBOImpl<T> implements CommonBO<T>{
	private SessionFactory sf;
	public JdbcTemplate jdbcTemplate;
	
	public JdbcTemplate getJdbcTemplate() {
		return jdbcTemplate;
	}
	@Autowired
	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
	public SessionFactory getSessionFactory() {
		return sf;
	}
	@Autowired
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sf = sessionFactory;
	}
	
	public Session getCurrentSession() {
		return getSessionFactory().getCurrentSession();
	}
	public void close(){
		if(sf!=null)sf.close();
	}
}
